package com.ddyx.rest;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.service.IEventPostLikeService;
import com.ddyx.service.IPostService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

/**
 * @ClassName: PostController.java
 * @Description: 朋友圈功能
 * @author: liuhoujie
 * @date: 2018年1月30日
 */
@Controller
@RequestMapping("/post")
public class PostController {
	
	@Resource
	IPostService postService;
	
	@Resource
	IEventPostLikeService eplService;
	
	/**
	 * @DESC 朋友圈列表 显示
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/findPostList" , method = RequestMethod.POST)
	public ResponseForm findPostList(@RequestBody RequestForm param) {
		return postService.findPostList(param);
	}
	
	/**
	 * @DESC 朋友圈 帖子详情
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/getPostDetail" , method = RequestMethod.POST)
	public ResponseForm getPostDetail(@RequestBody RequestForm param) {
		return postService.getPostDetail(param);
	}
	
	/**
	 * @DESC 点赞帖子
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/addPostLike" , method = RequestMethod.POST)
	public ResponseForm addPostLike(@RequestBody RequestForm param) {
		return eplService.addPostLike(param);
	}
	
	/**
	 * @DESC 取消点赞帖子
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/cancelPostLike", method =RequestMethod.POST)
	public ResponseForm cancelPostLike(@RequestBody RequestForm param) {
		return eplService.cancelPostLike(param);
	}
	
	/**
	 * @DESC 安卓端发送朋友圈
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/sendPost" , method = RequestMethod.POST)
	public ResponseForm sendPost(@RequestBody RequestForm param) {
		return postService.sendPost(param);
	}
	
	/**
	 * @DESC 安卓端获取post列表
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/androidPosts" , method = RequestMethod.POST)
	public ResponseForm androidPosts(@RequestBody RequestForm param) {
		return postService.androidPosts(param);
	}
	
	
	/**
	 * @DESC 安卓转发朋友圈
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/androidPostForward" , method = RequestMethod.POST)
	public ResponseForm androidPostForward(@RequestBody RequestForm param) {
		return postService.androidPostForward(param);
	}
}
